import {hrAjax as proFetch} from 'src/hrpub/common/utils/utils';

export default function viewCard() {
    const {orgVal, rosterData, selectedRowIndex} = this.state;
    const params = {
        pk_org: orgVal.refpk,
        allPsnPk: rosterData.map(item => item.pk_psndoc).join('_'),
        selRow: selectedRowIndex
    };
    proFetch({
        url: '/nccloud/hrhi/psndoc/PsndocCardReptQueryAction.do',
        body: params,
    })
        .then((res) => {
            if (res.success && res.data) {
                let location = window.location;
                location.port ?
                    window.open("uclient://start/http://" + location.hostname + ":" + location.port + res.data) :
                    window.open("uclient://start/http://" + location.hostname + res.data);
            }
        });
}
